<!DOCTYPE HTML>
<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>

<select id="menulist">
  <option selected>One</option>
  <option>Two</option>
  <option>Three</option>
</select>

<script>
test((t) => {
    var menulist = document.getElementById("menulist");
    menulist.focus();
    var accessibleMenulist = accessibilityController.focusedElement;

    function listener(notification) {
        document.getElementById("console").innerText += "Got notification: " + notification + "\n";
        accessibleMenulist.removeNotificationListener(listener);
        t.done();
    }

    accessibleMenulist.addNotificationListener(t.step_func(listener));

    // Change the selected index.
    menulist.selectedIndex = 1;

    // Make the test finish quickly whether we get the notification or not.
    window.setTimeout(t.step_func_done(() => {}), 10);
}, "This tests that changing the value of a menu list sends a notification even when it's not popped open.");
</script>
